<!DOCTYPE html>
<html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <head th:include="commom::title('添加患者')"></head>
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layui-form-pane">
    <div class="layui-form-item" >
        <label class="layui-form-label required">ID</label>
        <div class="layui-input-block">
            <input type="text" name="id" lay-verify="v_name" placeholder="请输入ID" th:value="${visitor.id}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" >
        <label class="layui-form-label required">病人ID</label>
        <div class="layui-input-block">
            <input type="text" name="patient_id" lay-verify="v_name" placeholder="请输入病人ID" th:value="${visitor.patient_id}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" >
        <label class="layui-form-label required" >医生ID</label>
        <div class="layui-input-block">
            <input type="text" name="doctor_id" lay-verify="v_name" placeholder="请输入医生ID" th:value="${visitor.doctor_id}" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item" >
        <label class="layui-form-label required" >位置</label>
        <div class="layui-input-block">
            <input type="text" name="position" lay-verify="v_name" placeholder="请输入位置" th:value="${visitor.position}" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item" >
        <label class="layui-form-label required" >已就诊人数</label>
        <div class="layui-input-block">
            <input type="text" name="finish_number" lay-verify="v_name" placeholder="请输入已就诊人数" th:value="${visitor.finish_number}" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block" >
            <button class="layui-btn layui-btn-normal" style="width: 80%"  lay-submit lay-filter="altBtn">确认修改</button>
        </div>
    </div>
</div>
<script th:src="@{/static/lib/layui-v2.5.5/layui.js}" charset="utf-8"></script>
<script>
    layui.use(['form','layer','laydate'], function () {
        const form = layui.form,
            layer = layui.layer,
            laydate=layui.laydate,
            $ = layui.$;
        // laydate.render({
        //     elem: '#viTime' ,
        //     type: 'date',
        // });
        // form.verify({
        //     v_name: function(value) {
        //         if (value.length < 2) {
        //             return '姓名至少得2个字符';
        //         }
        //     },
        // });
        form.on('submit(altBtn)', function (data) {
            $.ajax({
                url:'/root/modifyVis',
                data:data.field,
                dataType:'json',
                type:'post',
                success:function (data) {
                    if (data.code==200){
                        layer.msg(data.msg,{icon:1});
                    }else{
                        layer.msg(data.msg,{icon:2});
                    }
                    setTimeout(function () {
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                        window.parent.location.reload();
                    }, 1000);
                }
            })
            return false;
        });

    });
</script>
</body>
</html>
